package main

import (
	"streams/packet"

	log "github.com/sirupsen/logrus"
)

func main() {
	/*
		files, err := os.OpenFile("./test.dat", os.O_CREATE|os.O_RDONLY, 0666)
		if err != nil {
			log.Errorf("open test.dat file err(%v", err)
			return
		}

	*/
	rdp := packet.NewRtpParsePacket()

	// ps + system + map + sps + pps
	data := []byte{0x00, 0x00, 0x01, 0xba, 0x5e, 0xee, 0x05, 0x55, 0x74, 0x01,
		0x0e, 0xb3, 0x37, 0xfe, 0xff, 0xff, 0x00, 0xeb, 0xc1, 0x62, 0x00, 0x00, 0x01, 0xbb, 0x00, 0x12,
		0x87, 0x59, 0x9b, 0x04, 0xe1, 0x7f, 0xe0, 0xe0, 0x80, 0xc0, 0xc0, 0x08, 0xbd, 0xe0, 0x80, 0xbf,
		0xe0, 0x80, 0x00, 0x00, 0x01, 0xbc, 0x00, 0x5a, 0xfa, 0xff, 0x00, 0x24, 0x40, 0x0e, 0x48, 0x4b,
		0x01, 0x00, 0x13, 0x37, 0xc7, 0x3e, 0xa7, 0x9f, 0x00, 0xff, 0xff, 0xff, 0x41, 0x12, 0x48, 0x4b,
		0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
		0x00, 0x2c, 0x1b, 0xe0, 0x00, 0x28, 0x42, 0x0e, 0x07, 0x10, 0x10, 0xea, 0x07, 0x80, 0x04, 0x38,
		0x11, 0x10, 0xc0, 0x00, 0x1c, 0x21, 0x44, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
		0xff, 0xff, 0x2a, 0x0a, 0x7f, 0xff, 0x00, 0x00, 0x07, 0x08, 0x1f, 0xfe, 0xf0, 0x87, 0x0c, 0x9a,
		0x36, 0x23, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x26, 0x8c, 0x80, 0x07, 0x27, 0xbb, 0x81, 0x55, 0x5d,
		0xff, 0xfc, 0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x00, 0x2a, 0x96, 0x35, 0x40, 0xf0, 0x04, 0x4f,
		0xcb, 0x37, 0x01, 0x01, 0x01, 0x40, 0x00, 0x01, 0xc2, 0x00, 0x00, 0x57, 0xe4, 0x01, 0x00, 0x00,
		0x01, 0xe0, 0x00, 0x0e, 0x8c, 0x00, 0x03, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x01, 0x68, 0xee,
		0x3c, 0x80, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x0e, 0x8c, 0x00, 0x02, 0xff, 0xfc, 0x00, 0x00, 0x00,
		0x01, 0x06, 0xe5, 0x01, 0x67, 0x80}

	if parsed, err := rdp.Read(data); err != nil {
		log.Errorf("parse ps packet error(%v)", err)
		return
	} else {
		log.Warnf("parse ps packet success(%#x)", parsed)
	}
	return
}
